﻿namespace EFS.RC.SupervisorCentral.Controls.Agents
{
	/// <summary>
	/// Interaction logic for Main.xaml
	/// </summary>
	public partial class Main : System.Windows.Controls.UserControl
	{
		#region Delegates
		/// ContactListItem_OnButtonClickedDlg
		public EFS.RC.SupervisorCentral.Controls.Agents.ContactListItem.ButtonClickedDlg ContactListItem_OnButtonClickedDlg;
		#endregion

		public Main()
		{
			InitializeComponent();

			// ignore in design tool
			if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this))
			{
				controlAgentsACD.ContactListItem_OnButtonClickedDlg += ContactListItem_OnButtonClicked;
				controlAgentsNotACD.ContactListItem_OnButtonClickedDlg += ContactListItem_OnButtonClicked;
			}
		}

		#region Properties
		/// Property CustomerEndPoint: Get, Set
		public EFS.RC.CC.Messages.Application.CustomerEndPoint CustomerEndPoint
		{
			get
			{
				return controlAgentsACD.CustomerEndPoint;
			}
			set
			{
				controlAgentsACD.CustomerEndPoint = value;
				controlAgentsNotACD.CustomerEndPoint = value;

				// set text
				textBlockPhone.Text = value.PhoneUri;
			}
		}
		#endregion

		#region LoadData
		/// Add/Update agents
		public void AddUpdateAgents()
		{
			controlAgentsACD.AddUpdateAgents();
			controlAgentsNotACD.AddUpdateAgents();
		}
		#endregion

		#region Events
		/// ContactListItem_OnButtonClicked
		private void ContactListItem_OnButtonClicked(
			System.Windows.RoutedEventArgs routedEventArgs,
			EFS.RC.SupervisorCentral.Controls.Agents.ContactListItem.eButtonType buttonType,
			System.String agentSIP,
			System.String acd)
		{
			// call registered handlers
			if (null != this.ContactListItem_OnButtonClickedDlg)
			{
				this.ContactListItem_OnButtonClickedDlg(routedEventArgs, buttonType, agentSIP, acd);
			}
		}
		#endregion
	}
}